package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.entity.CmsProductRecommend;
import com.project.pojo.model.GetRecommendProductModel;
import com.project.pojo.model.UpdateRecommendProductSortModel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface CmsProductRecommendMapper extends BaseMapper<CmsProductRecommend> {

    /**
     * 获取目前最大排序值
     * @return
     */
    int getMaxSort();

    /**
     * 分页查询推荐商品
     * @param page
     * @param model
     * @return
     */
    IPage<CmsProductRecommend> selectRecommendProduct(Page<CmsProductRecommend> page, @Param("model") GetRecommendProductModel model);

    /**
     * 修改推荐商品排序值
     * @param model
     * @param userId
     * @return
     */
    int updateRecommendProductSort(@Param("model") UpdateRecommendProductSortModel model, @Param("userId") Long userId);

}